// 112.路径总和
package Leetcode_Second_Brush;

public class Solution112 {
    public boolean hasPathSum(TreeNode root, int targetSum) {
        if (root == null)
            return false;
        else if (root != null && root.left == null && root.right == null && targetSum == root.val)
            return true;
        else
            return hasPathSum(root.left, targetSum - root.val) || hasPathSum(root.right, targetSum - root.val);
    }
}
